package xyz.yuanjilu.controller;

import java.util.List;
import java.util.Map;


import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import xyz.yuanjilu.entity.GroovyScriptEntity;
import xyz.yuanjilu.service.GroovyService;
import xyz.yuanjilu.utils.PageUtils;
import xyz.yuanjilu.utils.Query;
import xyz.yuanjilu.utils.R;

@RestController
@RequestMapping("groovy")
public class GroovyController {
	Logger logger= LoggerFactory.getLogger(this.getClass());

	@Autowired
	private GroovyService groovyService;
	
	/**
     * 列表
     */
    @RequestMapping("/list")
//    @RequiresPermissions("groovyScript:list")
    public R list(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<GroovyScriptEntity> GroovyScriptEntitys = groovyService.queryList(query);
        int total =groovyService.queryTotal(query);
        PageUtils pageUtil = new PageUtils(GroovyScriptEntitys, total, query.getLimit(), query.getPage());
        return R.ok().put("page", pageUtil);
    }
}
